<template>
  <div id="toSubmit" class="box">
    <!-- <el-button class="btndai" type="primary" size="small">待后信息1</el-button> -->
    <div v-html="vHtml" style="overflow: hidden"></div>
  </div>
</template>

<script>
import { getRecordModel } from "../../../src/assets/js/api";
export default {
  name: "FillAnInFormation",
  props: ["orderNumber"],
  created() {
    this.vHtml = null;

  
    this.getRecordModel(this.orderNumber);
  },
  data() {
    return {
      vHtml: "",
      tableList: "",
    };
  },
  watch: {
    vHtml: function () {
      if (this.vHtml) {
        this.$emit("showbox", true);
      } else {
        this.$emit("showbox", false);
      }
    },
  },
  methods: {
    //获取补登信息
    getRecordModel(orderNumber) {    
      let obj = [];
      getRecordModel(orderNumber).then((res) => {
        if (res.data.length > 0) {
          this.tableList = res.data[0].approveTable;
          res.data.map((item) => {
            obj += item.approveTable;
          });
          this.vHtml = obj;
          this.$nextTick(function () {
            this.rebackTable();
          });
        }
      });
    },
    //回显table数据
    rebackTable() {
      let tableDiv = document.getElementById("toSubmit");
      let tagElements = tableDiv.getElementsByTagName("input");
      let tagText = tableDiv.getElementsByTagName("textarea");
      let tagSelect = tableDiv.getElementsByTagName("select");
      for (let j = 0; j < tagText.length; j++) {
        tagText[j].setAttribute("disabled", "disabled");
      }
      for (let j = 0; j < tagSelect.length; j++) {
        tagSelect[j].setAttribute("disabled", "disabled");
      }
      for (let i = 0; i < tagElements.length; i++) {
        tagElements[i].setAttribute("disabled", "disabled");
        // for (let key in this.tableList) {
        //   if (tagElements[i].name == key) {
        //     tagElements[i].value = this.tableList[key];
        //   }
        // }
      }
    },
  },
};
</script>

<style scoped type="less">
.box {
  position: relative;
}
.btndai {
  position: absolute;
  right: 0;
  top: -38px;
}
::v-deep .formDateList {
  border: 1px solid rgba(238, 238, 238, 1);
  border-radius: 8px;
  margin-top: 10px;
  padding: 10px;
}
::v-deep .information {
  text-align: left;
  padding-left: 20px;
}
/deep/.aa{
  position: relative;
}
/deep/.aa .bb{
  position: absolute;
  left: 60px;
  top: 6px;
  /* color: #a59999; */
}
/deep/ .aa .cc{
  position: absolute;
  right: 10px;
  top: 6px;
  /* color: #a59999; */

}
 /deep/ .aa .dd{
   width: 67%;
   /* text-align: center; */
 }
</style>
